﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    /// <summary>
    /// Lớp ảo một Game Model chứa Sprite
    /// </summary>
    public abstract class GameModel: VisibleGameEntity
    {
        protected MySprite _spriteModel;
        public MySprite SpriteModel
        {
            get { return _spriteModel; }
            set { _spriteModel = value; }
        }

        public bool InitModel(Texture2D[] inputTexture2Ds, Rectangle size, Vector2 origin)
        {
            this.SpriteModel = new MySprite(inputTexture2Ds, size,origin);
            return true;           
        }

        public void Update()
        {
            SpriteModel.Position = this.Position;
            SpriteModel.RotationAngle = this.RotationAngle;
        }

        public override void DrawToScreen(GameTime gameTime, SpriteBatch spriteBatch)
        {
            Update();
            SpriteModel.DrawToScreen(gameTime, spriteBatch);
        }
    }
}
